// 商品首页
<template>
	<view class="container" style="background-color: #151515;background-image: url('../../pages/center/bgColor.6bcb6b60.png');">
		<!-- 使用v-bind绑定了refreshCounter、getNextPageCounter、page、theme等属性，PageRender组件会自动调用refresh、getNextPage方法，实现下拉刷新和上拉加载功能 -->
		<PageRender :refreshCounter="refreshCounter" :getNextPageCounter="getNextPageCounter" :page="page"
			theme="default"></PageRender>

		<!-- <FloatBtn url="/pages/cart/index" :isAnimated="false" src="https://bus-cdn.hquesoft.com/box/shop-float-btn.png"></FloatBtn> -->
	</view>
</template>

<script>
	export default {
		components: {},
		data() {
			return {
				scrollTop: 0, // 页面滚动距离
				refreshCounter: 0, // refreshCounter是刷新时的计数器，每次下拉刷新时加1
				getNextPageCounter: 0 // getNextPageCounter是上拉加载时的计数器，每次上拉加载时加1
			}
		},
		computed: {
			page() {
				// 暂时屏蔽秒杀活动
				let list = this.$store.getters.setting.shop_home
				if(list.modules?.length){
					for(var k in list.modules){
						if(list.modules[k].uuid == "g28p3bjb"){
							list.modules.splice(k,1)
						}
					}
					return list
				}
				
				return this.$store.getters.setting.shop_home
			}
		},
		watch: {},
		onLoad() {
			this.$visitor.record('box_index');
		},
		onPullDownRefresh() {
			this.$showPullRefresh().then(res => {
				// 刷新成功，则增加一个 refreshCounter 变量
				this.refreshCounter++
			})
		},
		onShow() {
			this.$showPullRefresh().then(res => {
				// 刷新成功，则增加一个 refreshCounter 变量
				this.refreshCounter++
			})
		},
		methods: {},
		onReachBottom() {
			// 追踪触发了多少次滚动到底部的事件
			this.getNextPageCounter++
			// console.log('reach bottom')
		},
		// 页面滚动的信息存储在 this.scrollTop 变量中
		onPageScroll(e) {
			this.scrollTop = e.scrollTop
		}
	}
</script>

<style lang="scss" scoped>
	page {
		background: #151515
	}
</style>